package qq.android.wan.qq.recever;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import qq.android.wan.qq.chat.activity.CallActivity;

public class CallReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("test","打来语音电话了");
        //拨打方username
        String from = intent.getStringExtra("from");
        //call type
        String type = intent.getStringExtra("type");
        Log.e("test","语音类型:"+type);
        if ("video".equals(type)) { //视频通话
            context.startActivity(new Intent(context, CallActivity.class).
                    putExtra("from", from).putExtra("isComingCall", true).
                    addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        } else { //音频通话
            context.startActivity(new Intent(context, CallActivity.class).
                    putExtra("from", from).putExtra("isComingCall", true).
                    addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        }
        Log.d("test", "app received a incoming call");
    }

}
